** Merge 06-15 store price indices 
** JHL

*************************************
** Set up workspace
*************************************
version 14.0
clear all
set more off

cd "${path_home}"
** log using "${path_log}/c02_merge_PIq_06_15", text replace

*************************************
** Start work here
*************************************

timer on 1 

*************************************
** [1] Store-level price index, 06-15 
*************************************

use "${path_big_dta}/PI/storePIq_06_15_posted", clear 

gen yq = 183 + quarter
format yq %tq 

drop quarter
gen date = dofq(yq)
gen year = year(date)
gen quarter = quarter(date)
drop date 

foreach v of varlist TVC_t-PFL_VUL_nsub {
	local vv = lower("`v'")
	rename `v' `vv'
}

merge m:1 store_code_uc year using "${path_big_dta}/nielsen/stores_0615", keep(master match) nogen 

save "${path_big_dta}/PI/PIq_stores_0615", replace

*************************************
** Close workspace
*************************************
** log close
timer off 1
timer list 1 